package com.terrapages.wmsc4j.layer.tile;

import java.awt.Dimension;


/**
 * This gives information about the format of the images of a layer
 * 
 * @author mvivian
 *
 */
public class TileFormat  {	
	private Dimension tileSize;
	private String fileExtension;
	private final ImageMimeType mimetype;
	
	/**
	 * @param tileSize
	 * @param mimetype
	 * @param fileExtension
	 */
	public TileFormat(Dimension tileSize, ImageMimeType mimetype, String fileExtension) {
		this.fileExtension = fileExtension;
		this.mimetype = mimetype;
		this.tileSize = tileSize;
	}
	
	/**
	 * @param tileSize
	 * @param mimetype
	 */
	public TileFormat(Dimension tileSize, ImageMimeType mimetype) {
		this.mimetype = mimetype;
		this.tileSize = tileSize;
		this.fileExtension = mimetype.name().toLowerCase();
	}
	
	/**
	 * @return the extension
	 */
	public final String getFileExtension() {
		return fileExtension;
	}
	
	/**
	 * @param extension the extension to set
	 */
	public final void setFileExtension(final String fileExtension) {
		this.fileExtension = fileExtension;
	}
	
	/**
	 * @return the mimetype
	 */
	public final ImageMimeType getMimetype() {
		return mimetype;
	}

	
	@Override
	public TileFormat clone(){
		return new TileFormat(tileSize,mimetype,fileExtension);
	}

	/**
	 * @return the tilesize
	 */
	public final Dimension getTileSize() {
		return tileSize;
	}

	/**
	 * @param tilesize the tilesize to set
	 */
	public final void setTileSize(final Dimension tileSize) {
		this.tileSize = tileSize;
	}
}
